import { Define, EntityObjectFactory } from 'tiny-entity2';
const EntityObjectType = EntityObjectFactory.GetEntityObjectType(process.env.dataBaseType || 'mysql');
import { ProduceOrderItem } from './produceOrderItem';
@Define.Table({ TableName: 'produceorder' })
export class ProduceOrder extends EntityObjectType<ProduceOrder> {
    @Define.PrimaryKey()
    id: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        DefaultValue: 'init',
        NotAllowNULL: true
    })
    status: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR
    })
    operatorId: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR
    })
    operatorName: string;

    @Define.Column({
        DataType: Define.DataType.BIGINT
    })
    createTime: number;

    @Define.Column({
        DataType: Define.DataType.Decimal,
        DefaultValue: 0
    })
    totalQty: number;

    @Define.Column({
        DataType: Define.DataType.VARCHAR
    })
    serialNo: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        NotAllowNULL: true,
        IsIndex: true
    })
    storeId: string;

    @Define.Column({
        DataType: Define.DataType.BIGINT
    })
    version: number;

    @Define.Mapping({
        Mapping: 'ProduceOrderItem',
        MappingKey: 'produceOrderId'
    })
    produceOrderItems: ProduceOrderItem[];
}

export const ProduceOrderStatus = {
    Init: 'init',
    Cancelled: 'cancelled',
    Delivered: 'delivered'
}